package core;

import static view.Constants.MAPPING;

import java.io.Serializable;

/**
 * @author Mostafa Mahmod Mahmod Eweda
 * <pre>mostafa_eweda17@yahoo.com</pre>
 * 
 * @since JDK 1.6
 * @version 1.0
 * 
 * The representation of the compressed character to be written to the file
 * 
 */
public class CompressedChar implements Comparable<CompressedChar>, Serializable
{
	private static final long serialVersionUID = 1L;

	public long sequence;

	public byte length;

	public byte ch;

	public CompressedChar(long i, byte length, byte ch)
	{
		
		this.sequence = i;
		this.length = length;
		this.ch = ch;
	}

	@Override
	public int compareTo(CompressedChar o)
	{
		return o.length - length;
	}

	public String toString()
	{
		return "Char = " + (char)(ch+MAPPING) + "   length = " + length + "   Sequence: "  + sequence; 
	}
}
